package DatingApp;

import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.Manager;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.component.EditField;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.HorizontalFieldManager;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.container.VerticalFieldManager;

public class Registration extends MainScreen implements FieldChangeListener{

	private EditField firstNameField, lastNameField, countryField, cityField, ethnicityField, religionField, politicalField, phoneNumField, bbimField, emailField, ageField,
			heightField, genderField, biographyField, interestsField, confirmEmailField, passField, confirmPassField; 
	
	private VerticalFieldManager left, right;
	
	private ButtonField confirm;
	
	/**
	 * 
	 */
	public Registration(){
		bbimField = new EditField();
		firstNameField = new EditField();
		lastNameField = new EditField();
		countryField =  new EditField();
		cityField = new EditField();
		ethnicityField = new EditField();
		religionField = new EditField();
		politicalField = new EditField();
		phoneNumField = new EditField();
		emailField = new EditField();
		confirmEmailField = new EditField();
		ageField = new EditField();
		heightField = new EditField();
		genderField = new EditField();
		biographyField = new EditField();
		interestsField  = new EditField();
		passField = new EditField();
		confirmPassField = new EditField();
		
		left = new VerticalFieldManager();
		right = new VerticalFieldManager();
		
		confirm = new ButtonField("REGISTER");
		confirm.setChangeListener(this);
		
		initializeFields();
	}
	
	private void initializeFields(){
		setTitle("Registration");
		Manager body = new HorizontalFieldManager(Manager.VERTICAL_SCROLL);
		left.add(new LabelField("BBM pin:", Manager.FIELD_RIGHT));
		left.add(new LabelField("First Name:", Manager.FIELD_RIGHT));
		left.add(new LabelField("Last Name:", Manager.FIELD_RIGHT));
		left.add(new LabelField("Gender:", Manager.FIELD_RIGHT));
		left.add(new LabelField("Email:", Manager.FIELD_RIGHT));
		left.add(new LabelField("Confirm Email:", Manager.FIELD_RIGHT));
		left.add(new LabelField("Password:", Manager.FIELD_RIGHT));
		left.add(new LabelField("Confirm Password:", Manager.FIELD_RIGHT));
		left.add(new LabelField("Date of Birth:", Manager.FIELD_RIGHT));
		left.add(new LabelField("City:", Manager.FIELD_RIGHT));
		left.add(new LabelField("Country:", Manager.FIELD_RIGHT));
		left.add(new LabelField("Phone #:", Manager.FIELD_RIGHT));
		left.add(new LabelField("Height:", Manager.FIELD_RIGHT));
		left.add(new LabelField("Ethnicity:", Manager.FIELD_RIGHT));
		left.add(new LabelField("Religion:", Manager.FIELD_RIGHT));
		left.add(new LabelField("Political View:", Manager.FIELD_RIGHT));
		left.add(new LabelField("Biography:", Manager.FIELD_RIGHT));
		left.add(new LabelField("Interests:", Manager.FIELD_RIGHT));
		
		right.add(bbimField);
		right.add(firstNameField);
		right.add(lastNameField);
		right.add(genderField);
		right.add(emailField);
		right.add(confirmEmailField);
		right.add(passField);
		right.add(confirmPassField);
		right.add(ageField);
		right.add(cityField);
		right.add(countryField);
		right.add(phoneNumField);
		right.add(heightField);
		right.add(ethnicityField);
		right.add(religionField);
		right.add(politicalField);
		right.add(biographyField);
		right.add(interestsField);
		
		body.add(left);
		body.add(right);
		
		add(body);
		add(this.confirm);
	}
	
	/**
	 * 
	 */
	public void fieldChanged(Field field, int context) {
		if (field == confirm){
			Dialog.inform("Registration Complete");
			this.close();
		}
		
	}

}
